<html>
<head><meta charset="utf-8"><title>MCP: document &#x27;variables&#x27; as &#x27;bindings&#x27; instead? · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html">MCP: document &#x27;variables&#x27; as &#x27;bindings&#x27; instead?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="208727039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208727039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208727039">(Sep 01 2020 at 18:21)</a>:</h4>
<p>'immutable variable' is a contradiction if you hear it in English, but comes up a lot in rust. Would it be better to document this as 'immutable binding' instead?</p>
<p>I don't have a specific place where this is said, I'm sure it's throughout the Book and standard library. But it seems like 'binding' is more clear even if it's less familiar when coming from another language.</p>



<a name="208727169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208727169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208727169">(Sep 01 2020 at 18:22)</a>:</h4>
<p>strawman example: <a href="https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html?highlight=variable#variables-and-mutability">Chapter 3</a> starts with</p>
<blockquote>
<p>As mentioned in Chapter 2, by default variables are immutable</p>
</blockquote>



<a name="208727315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208727315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208727315">(Sep 01 2020 at 18:23)</a>:</h4>
<p>"binding" has some existing usage w.r.t. patterns</p>



<a name="208727352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208727352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208727352">(Sep 01 2020 at 18:23)</a>:</h4>
<p>A tricky thing is that immutable variables <em>do</em> vary.</p>



<a name="208727388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208727388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208727388">(Sep 01 2020 at 18:23)</a>:</h4>
<p>you mean like interior mutability?</p>



<a name="208727460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208727460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208727460">(Sep 01 2020 at 18:24)</a>:</h4>
<blockquote>
<p><a href="https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html?highlight=binding#-bindings">Bindings</a></p>
<p>The at operator (@) lets us create a variable</p>
</blockquote>
<p>this seems like the same concept to me really, just without <code>let</code> or <code>static</code></p>



<a name="208727519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208727519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208727519">(Sep 01 2020 at 18:24)</a>:</h4>
<p><code>fn example(foo: i32) {}</code>. The <code>foo</code> variable cannot be mutated, but it varies from call-to-call</p>



<a name="208727572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208727572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208727572">(Sep 01 2020 at 18:25)</a>:</h4>
<p>I mean, sure, but I don't think that makes 'binding' a worse name for the parameter</p>



<a name="208727629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208727629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208727629">(Sep 01 2020 at 18:25)</a>:</h4>
<p>you're binding an input argument to a name</p>



<a name="208727695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208727695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208727695">(Sep 01 2020 at 18:26)</a>:</h4>
<p>it sidesteps the whole issue <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="208727717"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208727717" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208727717">(Sep 01 2020 at 18:26)</a>:</h4>
<p>I'm not particularly arguing for or against anything, just providing points that occur to me.</p>



<a name="208727737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208727737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208727737">(Sep 01 2020 at 18:26)</a>:</h4>
<p>"immutable variable" isn't a Rust-specific term</p>



<a name="208727769"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208727769" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208727769">(Sep 01 2020 at 18:26)</a>:</h4>
<p>(I have a tendency to seek out internet arguments :P)</p>



<a name="208727866"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208727866" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208727866">(Sep 01 2020 at 18:27)</a>:</h4>
<p>Even if it had been called "binding" forever and consistently, would we still have a teachability problem for anyone coming from another language? Would we have to say "bindings are what other languages call variables"? If so, would the magnitude of problem be greater or less?</p>



<a name="208727928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208727928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208727928">(Sep 01 2020 at 18:28)</a>:</h4>
<p>Arguably, it is the programming sense of "variable" that is incorrect here. Variables are symbols that can denote a range of values, as used in mathematics. Variables meaning storage locations should be called something like "assignables" instead, but I'm not the king of english and I think that it's too late to change usage</p>



<a name="208727994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208727994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208727994">(Sep 01 2020 at 18:28)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116155">Jake Goulding</span> <a href="#narrow/stream/122651-general/topic/MCP.3A.20document.20'variables'.20as.20'bindings'.20instead.3F/near/208727866">said</a>:</p>
<blockquote>
<p>Even if it had been called "binding" forever and consistently, would we still have a teachability problem for anyone coming from another language? Would we have to say "bindings are what other languages call variables"? If so, would the magnitude of problem be greater or less?</p>
</blockquote>
<p>I don't think it would be more confusing than e.g. 'place expressions' instead of 'lval'</p>



<a name="208728018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208728018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208728018">(Sep 01 2020 at 18:29)</a>:</h4>
<p>I guess 'lval' is much less common than 'variable' outside of the compiler world though</p>



<a name="208728042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208728042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208728042">(Sep 01 2020 at 18:29)</a>:</h4>
<blockquote>
<p>e.g. 'place expressions' instead of 'lval'</p>
</blockquote>
<p>I think the audience for... yeah — the people who care is much smaller.</p>



<a name="208728127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208728127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208728127">(Sep 01 2020 at 18:30)</a>:</h4>
<p>And I expect compiler writers to be further along the "accept pain for pedantry"  scale</p>



<a name="208728139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208728139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208728139">(Sep 01 2020 at 18:30)</a>:</h4>
<blockquote>
<p>Variables meaning storage locations should be called something like "assignables" instead, but I'm not the king of english</p>
</blockquote>
<p>rust calls these 'place expressions'</p>



<a name="208728182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208728182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208728182">(Sep 01 2020 at 18:30)</a>:</h4>
<p>which is more broad than a variable, it includes things like <code>vec[0]</code></p>



<a name="208728187"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208728187" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208728187">(Sep 01 2020 at 18:30)</a>:</h4>
<p>place expressions are ways to denote storage locations (or subparts thereof)</p>



<a name="208728263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208728263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208728263">(Sep 01 2020 at 18:31)</a>:</h4>
<p>I think "place expression" is a narrow and precise term that is less confusing than C's "lvalue"</p>



<a name="208728416"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208728416" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208728416">(Sep 01 2020 at 18:32)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116155">Jake Goulding</span> <a href="#narrow/stream/122651-general/topic/MCP.3A.20document.20'variables'.20as.20'bindings'.20instead.3F/near/208727866">said</a>:</p>
<blockquote>
<p>Even if it had been called "binding" forever and consistently, would we still have a teachability problem for anyone coming from another language? Would we have to say "bindings are what other languages call variables"? If so, would the magnitude of problem be greater or less?</p>
</blockquote>
<p>for context, this came up in #beginners with someone from javascript confused between <code>let</code> and <code>const</code></p>



<a name="208728440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208728440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208728440">(Sep 01 2020 at 18:33)</a>:</h4>
<p>since JS has the same keywords that mean very different things</p>



<a name="208728475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208728475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208728475">(Sep 01 2020 at 18:33)</a>:</h4>
<p>but to denote a symbol introduced by <code>let</code>, I would suggest "variable binding" over just "binding" because otherwise it's not clear what is being bound</p>



<a name="208728524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208728524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208728524">(Sep 01 2020 at 18:33)</a>:</h4>
<p>I'm not sure I follow ... what else could be a binding?</p>



<a name="208728599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208728599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208728599">(Sep 01 2020 at 18:34)</a>:</h4>
<p>One thing I've always disliked about "binding" is that it's a verb and a noun</p>



<a name="208728637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208728637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208728637">(Sep 01 2020 at 18:34)</a>:</h4>
<p>well the variables bound by a quantifier or lambda are also called bindings sometimes</p>



<a name="208728675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208728675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208728675">(Sep 01 2020 at 18:35)</a>:</h4>
<p>"variable binding" makes it sound like "bound variable", which is kind of confusing if you consider <a href="https://en.wikipedia.org/wiki/Free_variables_and_bound_variables">https://en.wikipedia.org/wiki/Free_variables_and_bound_variables</a></p>



<a name="208728686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208728686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208728686">(Sep 01 2020 at 18:35)</a>:</h4>
<p>It is a bound variable</p>



<a name="208728706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208728706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208728706">(Sep 01 2020 at 18:35)</a>:</h4>
<p>ahh I see the confusion</p>



<a name="208728789"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208728789" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208728789">(Sep 01 2020 at 18:36)</a>:</h4>
<p><span class="user-mention" data-user-id="211727">@Jonas Schievink</span> that's a feature, not a bug</p>



<a name="208729542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208729542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208729542">(Sep 01 2020 at 18:41)</a>:</h4>
<p><span class="user-mention silent" data-user-id="271719">Mario Carneiro</span> <a href="#narrow/stream/122651-general/topic/MCP.3A.20document.20'variables'.20as.20'bindings'.20instead.3F/near/208728637">said</a>:</p>
<blockquote>
<p>well the variables bound by a quantifier or lambda are also called bindings sometimes</p>
</blockquote>
<p>'bound variable' sounds somewhat similar to the formal logic version of this? <a href="https://en.wikipedia.org/wiki/Bounded_quantifier">https://en.wikipedia.org/wiki/Bounded_quantifier</a></p>



<a name="208729737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208729737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208729737">(Sep 01 2020 at 18:43)</a>:</h4>
<p>I don't know any type theory though and very little formal logic</p>



<a name="208730354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208730354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208730354">(Sep 01 2020 at 18:48)</a>:</h4>
<p>If there's one thing users of programming languages love, it's knowing deep computer science theory in order to store the age of a cat.</p>



<a name="208731068"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208731068" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208731068">(Sep 01 2020 at 18:52)</a>:</h4>
<p>well, I don't think we need to teach bound quantifiers at the same time <span aria-label="laughter tears" class="emoji emoji-1f602" role="img" title="laughter tears">:laughter_tears:</span></p>



<a name="208731269"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208731269" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208731269">(Sep 01 2020 at 18:54)</a>:</h4>
<p>Actually, a bounded quantifier is a conflicting usage of the word "bound", since that is derived from usage like "bounded above" rather than "bound variable". Ultimately they come from the same linguistic usage though. <span aria-label="shrug" class="emoji emoji-1f937" role="img" title="shrug">:shrug:</span></p>



<a name="208731372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208731372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208731372">(Sep 01 2020 at 18:55)</a>:</h4>
<p>in PL theory this shows up in things like type bounds, in rust that means things like <code>'a: 'b</code> and <code>T: Copy</code></p>



<a name="208731493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208731493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208731493">(Sep 01 2020 at 18:55)</a>:</h4>
<p>which don't so much create a new symbol in a scope as constrain an existing symbol</p>



<a name="208731546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208731546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208731546">(Sep 01 2020 at 18:56)</a>:</h4>
<p>ah hmm what does rust call the restriction for <code>T: Copy</code> ? is that also a binding?</p>



<a name="208731573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208731573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Chase Wilson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208731573">(Sep 01 2020 at 18:56)</a>:</h4>
<p>I'd argue that this is more of a non-issue since "variable" in the context of computer science means a rather different thing than "variable" in common english</p>
<p>From <a href="https://en.wikipedia.org/wiki/Variable_(computer_science)">Wikipedia</a>:</p>
<blockquote>
<p>In computer programming, a variable or scalar is a storage location (identified by a memory address) paired with an associated symbolic name, which contains some known or unknown quantity of information referred to as a value</p>
</blockquote>



<a name="208731580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208731580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208731580">(Sep 01 2020 at 18:56)</a>:</h4>
<p>it's a bound, not a binding</p>



<a name="208731611"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208731611" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208731611">(Sep 01 2020 at 18:56)</a>:</h4>
<p>ooh, "scalar"</p>



<a name="208731625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208731625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208731625">(Sep 01 2020 at 18:56)</a>:</h4>
<p>haven't heard that in a while</p>



<a name="208731647"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208731647" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208731647">(Sep 01 2020 at 18:56)</a>:</h4>
<p>let's not start calling aggregates scalars lol</p>



<a name="208731911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208731911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208731911">(Sep 01 2020 at 18:58)</a>:</h4>
<p>In all seriousness, the debate over what to call these things ended long ago. They are variables</p>



<a name="208732179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208732179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208732179">(Sep 01 2020 at 19:00)</a>:</h4>
<p>it's a bit annoying that the bad name confuses every new generation with the difference between the sense of "vary" in use in CS variables vs math variables, but there's nothing that can be done about it besides more education</p>



<a name="208732665"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208732665" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208732665">(Sep 01 2020 at 19:04)</a>:</h4>
<p>I agree with the end result of keeping it "variable", but will quibble with the path taken to get there :-)</p>
<p>Rust likes to do the impossible, so I wouldn't want to say "thus it was once, forever shall it be" (if that's what we followed, there' wouldn't even be a Rust). It's mostly a matter of cost-benefit analysis to me.</p>



<a name="208733286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208733286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208733286">(Sep 01 2020 at 19:07)</a>:</h4>
<p>I think it is useful to note that <code>let x = 5;</code> is sometimes called a "let-binding" because it binds a value to a name, but otherwise there isn't much sense in harping on the distinction in a weakly functional language like rust</p>



<a name="208733481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208733481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208733481">(Sep 01 2020 at 19:09)</a>:</h4>
<p>And the book <a href="https://doc.rust-lang.org/stable/book/ch02-00-guessing-game-tutorial.html?highlight=binding#storing-values-with-variables">uses that sense as well</a>:</p>
<blockquote>
<p>This line creates a new variable named foo and binds it to the value of the bar variable</p>
</blockquote>



<a name="208749202"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208749202" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208749202">(Sep 01 2020 at 21:10)</a>:</h4>
<p>binding is correct, for both mutable and immutable. variable is silly for both. it'll be called variables anyway. oh well.</p>



<a name="208762487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208762487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208762487">(Sep 01 2020 at 23:36)</a>:</h4>
<blockquote>
<p>At that point, the <strong>binding</strong> for state will be the value UsState::Alaska. We can then use that <strong>binding</strong> in the println! expression, thus getting the inner state value out of the Coin enum variant for Quarter.</p>
</blockquote>
<ul>
<li><a href="https://doc.rust-lang.org/book/ch06-02-match.html?highlight=binding#patterns-that-bind-to-values">The Rust Programming Language</a></li>
</ul>
<blockquote>
<p>The pattern in the second match arm introduces a new <strong>variable</strong> named y that will match any value inside a Some value. Because we’re in a new scope inside the match expression, this is <strong>a new y variable</strong>, not the y we <strong>declared</strong> at the beginning with the value 10. This new <strong>y binding</strong> will match any value inside a Some, which is what we have in x. Therefore, this <strong>new y binds</strong> to the inner value of the Some in x. That value is 5, so the expression for that arm executes and prints Matched, y = 5.</p>
</blockquote>
<p>...</p>
<blockquote>
<p>@ <strong>Bindings</strong><br>
The at operator (@) lets us create a <strong>variable</strong> that <strong>holds</strong> a value at the same time we’re testing that value to see whether it matches a pattern. </p>
</blockquote>
<ul>
<li><a href="https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html?highlight=binding#matching-named-variables">The Rust Programming Language</a></li>
</ul>
<p>These are a little confusing to me as someone from an... eccentric programming background.</p>
<p>I think that backing up a little and introducing more formally the concept of "here is an identifier, here is an expression that evaluates to a value, this statement binds the two, this is the concept of 'variable' you may be familiar with from programming or math class but it works Differently in Rust" is not a bad idea. I think pressing more things to go in a specific terminological direction in documentation would be a good idea. I often use "declaration" because I hesitate between (binding/variable), actually.</p>



<a name="208763568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208763568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208763568">(Sep 01 2020 at 23:53)</a>:</h4>
<p>Like... does a "variable" really "hold" a value? Or does it identify the value? What about ownership? How do you want to express the transfers of ownership that occur? I think backing up a step and really thinking about how to express it from first principles is actually best here because basically the concept is not terribly consistently named in any contextso any way you move will conflict with another definition. As such, it might be best to E̶M̸B̸R̸A̵C̵E̵ ̶C̸O̴N̷F̵L̴I̵C̴T̴, even if it feels like reinventing the wheel w/r/t basic computer science, even if you wind up agreeing in a certain direction, <em>because</em> Rust <em>does</em> have the ownership system that is only indirect in other languages, so starting off with "Yes, you may have to reevaluate the basics" is not a bad idea.</p>



<a name="208763884"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208763884" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208763884">(Sep 01 2020 at 23:58)</a>:</h4>
<p>To stir the pot some more, the names are normally called 'identifiers' in compilers</p>



<a name="208763913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208763913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208763913">(Sep 01 2020 at 23:58)</a>:</h4>
<p>But that refers to the actual name, not the value bound to that name</p>



<a name="208763971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208763971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208763971">(Sep 01 2020 at 23:59)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/122651-general/topic/MCP.3A.20document.20'variables'.20as.20'bindings'.20instead.3F/near/208763884">said</a>:</p>
<blockquote>
<p>To stir the pot some more, the names are normally called 'identifiers' in compilers</p>
</blockquote>
<p>I don't know that's a fruitful direction, as <code>foo::bar::&lt;Baz&gt;()</code> has three identifiers, none of which are relevant to variables.</p>



<a name="208764467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208764467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> isHavvy <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208764467">(Sep 02 2020 at 00:05)</a>:</h4>
<p>"Variable" is jargon, but it's jargon that every language uses. "Binding" has the same meaning but it's not in widespread usage. Yes, it has a meaning separate from the mathematical meaning, but that's fine. So does <code>Vec</code>.</p>



<a name="208764660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208764660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208764660">(Sep 02 2020 at 00:07)</a>:</h4>
<blockquote>
<p>but it's jargon that every language uses</p>
</blockquote>
<p>I think that's the original point. Every language uses it, but mostly uses it the same. The claim is that Rust uses it differently enough that maybe it shouldn't be called that.</p>



<a name="208764747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208764747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208764747">(Sep 02 2020 at 00:08)</a>:</h4>
<p>Similarly, if I could, I'd go back and rename "lifetime" because it conflicts with the existing meaning (of those people that have thought about it before).</p>



<a name="208764843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208764843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208764843">(Sep 02 2020 at 00:09)</a>:</h4>
<p>As a silly/strawman example, if we called functions "variables", then you could apply the "jargon" argument equally to say it should stay that way <span aria-label="wink" class="emoji emoji-1f609" role="img" title="wink">:wink:</span></p>



<a name="208764986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208764986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> isHavvy <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208764986">(Sep 02 2020 at 00:11)</a>:</h4>
<p>If for some reason, the entire programming field decided to do so, sure. Also note that what we call "function"s are also not mathematical functions as well.</p>



<a name="208765393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208765393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208765393">(Sep 02 2020 at 00:17)</a>:</h4>
<p>I dunno, I think talking about idents is kinda useful because users grow up and write macros which can reference an <code>$ident</code>, and that is one of the few things the language formally specifies in the Reference! And programmers _do_ read the Reference!</p>
<p>I basically think the JS programmer (hi!) is helped most by a definition that can be actually read and written to HD, even if it reiterates "common knowledge", instead of relying on their type inference.</p>



<a name="208766424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208766424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208766424">(Sep 02 2020 at 00:32)</a>:</h4>
<p>Don't open the "naming functions" box too! Otherwise I might have to explain why they should be called procedures instead</p>



<a name="208766620"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208766620" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208766620">(Sep 02 2020 at 00:35)</a>:</h4>
<p>I think you mean routines. Or subroutines.</p>



<a name="208766801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208766801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208766801">(Sep 02 2020 at 00:37)</a>:</h4>
<p>programming functions are totally functions, they just take the global state as an implicit arg :^)</p>



<a name="208766873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208766873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208766873">(Sep 02 2020 at 00:38)</a>:</h4>
<p>they are also not deterministic even once you give them the global state, unless you believe in determinism of the universe</p>



<a name="208766997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208766997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208766997">(Sep 02 2020 at 00:40)</a>:</h4>
<p>Another can of worms: I wish Rust had pure functions. I think it used to have something like that with <code>pred</code>, right?</p>



<a name="208767000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208767000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208767000">(Sep 02 2020 at 00:40)</a>:</h4>
<p>I actually am epistemically skeptical that even math is deterministic over the entire domain of universes.</p>



<a name="208767140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208767140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208767140">(Sep 02 2020 at 00:43)</a>:</h4>
<p>Haha wikipedia calls them "callable units" to avoid the naming war <a href="https://en.wikipedia.org/wiki/Subroutine">https://en.wikipedia.org/wiki/Subroutine</a></p>



<a name="208767330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208767330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208767330">(Sep 02 2020 at 00:46)</a>:</h4>
<p><span class="user-mention" data-user-id="307537">@Camelid</span> <code>const fn</code> is pretty close to a pure function, although maybe it is a bit restricted</p>



<a name="208767349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208767349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208767349">(Sep 02 2020 at 00:47)</a>:</h4>
<p>then again, the restrictions are all in places where functional programming is actually non-functional under the hood</p>



<a name="208767498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208767498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208767498">(Sep 02 2020 at 00:49)</a>:</h4>
<p>and the places in which it allows impurity are the places in which nonfunctional programming doesn't significantly vary from functional programming.</p>



<a name="208767653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208767653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> isHavvy <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208767653">(Sep 02 2020 at 00:52)</a>:</h4>
<p>There was a <code>pure</code> keyword, pre-1.0. Because nobody could actually agree on what they wanted out of purity, it was removed. <code>const purity</code> was one such definition that people considered.</p>



<a name="208773267"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208773267" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208773267">(Sep 02 2020 at 02:27)</a>:</h4>
<p><span class="user-mention" data-user-id="296643">@isHavvy</span> Huh, I've never heard of the <code>pure</code> keyword. Thanks for bringing it up, I'm going to look into it!</p>



<a name="208773644"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208773644" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208773644">(Sep 02 2020 at 02:35)</a>:</h4>
<p>I think it's interesting how Rust reverted from the <code>ret</code> keyword to the standard <code>return</code> keyword given that other parts of Rust (<code>fn</code>, <code>mut</code>, <code>mod</code>, etc.) use a shortened form. Can anyone point me to when that happened?</p>



<a name="208773787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208773787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208773787">(Sep 02 2020 at 02:38)</a>:</h4>
<p>Ah, it looks maybe in <a href="https://github.com/rust-lang/rust/issues/3063">#3063</a>.</p>



<a name="208773817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208773817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208773817">(Sep 02 2020 at 02:39)</a>:</h4>
<p>I love <code>@brson</code>'s <a href="https://github.com/rust-lang/rust/issues/3063#issuecomment-7564850">comment</a>:</p>
<blockquote>
<p>ret and alt are done. I refused to do the mod change and nobody seemed to mind.</p>
</blockquote>



<a name="208774012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208774012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208774012">(Sep 02 2020 at 02:43)</a>:</h4>
<p>Commit <a href="https://github.com/rust-lang/rust/commit/b355936b4da0831f47afe8f251daee503c8caa32">b355936b4da0831f47afe8f251daee503c8caa32</a> is where ret was changed to return. This is kind of OT, so I'll move this to another topic</p>



<a name="208801033"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208801033" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208801033">(Sep 02 2020 at 09:50)</a>:</h4>
<p>FWIW, "immutable variable" seems completely reasonable to me. In mathematics we have "variables" all the time and <em>of course</em> they are all immutable.</p>



<a name="208801048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208801048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208801048">(Sep 02 2020 at 09:51)</a>:</h4>
<p>It's the mutable variables that are the odd ones out, really. ;)</p>



<a name="208801157"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208801157" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208801157">(Sep 02 2020 at 09:52)</a>:</h4>
<p>In programming languages research, these things are always called variables, whether they are mutable or not. I have never heard the noun "binding" used in a research context (Rust may have made that up?), but there is such a thing as a "binder", which is the syntactic place where a variable name gets bound (i.e., it is the declaration, as opposed to a use).</p>



<a name="208801424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/208801424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#208801424">(Sep 02 2020 at 09:56)</a>:</h4>
<div class="codehilite"><pre><span></span><code><span class="kd">let</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">15</span><span class="p">;</span><span class="w"> </span><span class="c1">// here the name x gets &quot;bound&quot; to value 15. So the `x` here is a binder. (&quot;binding occurrence&quot; of &quot;x&quot;)</span>
<span class="k">return</span><span class="w"> </span><span class="n">x</span><span class="p">;</span><span class="w"> </span><span class="c1">// here the name x that was bound above is used. this is not a binder.</span>
</code></pre></div>



<a name="209246038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/209246038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#209246038">(Sep 06 2020 at 23:17)</a>:</h4>
<p>FWIW <a href="https://fasterthanli.me/articles/i-am-a-java-csharp-c-or-cplusplus-dev-time-to-do-some-rust">https://fasterthanli.me/articles/i-am-a-java-csharp-c-or-cplusplus-dev-time-to-do-some-rust</a> also distinguishes between 'variables' and 'bindings'</p>



<a name="209246048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/209246048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#209246048">(Sep 06 2020 at 23:17)</a>:</h4>
<p>hmm maybe that's what we should document: 'variable' is the whole thing, identifier, memory address, and value, but 'binding' is specifically the identifier</p>



<a name="209246233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/209246233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#209246233">(Sep 06 2020 at 23:23)</a>:</h4>
<p>I agree, obviously.</p>



<a name="209252362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/209252362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#209252362">(Sep 07 2020 at 02:36)</a>:</h4>
<p>That article contains a snippet of "Rust as written by a C#/Java/C++ programmer", which I find quite valuable as a metric for error message quality. In particular, this:</p>
<div class="codehilite"><pre><span></span><code><span class="k">struct</span> <span class="nc">App</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">title</span>: <span class="nb">String</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">ticks_left</span>: <span class="kt">usize</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">running</span>: <span class="kt">bool</span><span class="p">,</span><span class="w"></span>

<span class="w">    </span><span class="k">fn</span> <span class="nf">update</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">this</span><span class="p">.</span><span class="n">ticks_left</span><span class="w"> </span><span class="o">-=</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span><span class="w"></span>
<span class="w">        </span><span class="k">if</span><span class="w"> </span><span class="n">this</span><span class="p">.</span><span class="n">ticks_left</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="mi">0</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="n">this</span><span class="p">.</span><span class="n">running</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">false</span><span class="p">;</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>


<p>Generates the error <code>expected identifier, found keyword `fn` </code>, which is correct but not as helpful as it could be. The error message should suggest an <code>impl App { fn update() ... }</code> block here. (Adding in a <code>&amp;self</code> parameter in the suggestion is possible but probably too ambitious.)</p>



<a name="209252444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/209252444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#209252444">(Sep 07 2020 at 02:38)</a>:</h4>
<p>Yeah, if you just write</p>
<div class="codehilite"><pre><span></span><code><span class="k">struct</span> <span class="nc">App</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">title</span>: <span class="nb">String</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">ticks_left</span>: <span class="kt">usize</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">running</span>: <span class="kt">bool</span><span class="p">,</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
<span class="k">impl</span><span class="w"> </span><span class="n">App</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">update</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">this</span><span class="p">.</span><span class="n">ticks_left</span><span class="w"> </span><span class="o">-=</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span><span class="w"></span>
<span class="w">        </span><span class="k">if</span><span class="w"> </span><span class="n">this</span><span class="p">.</span><span class="n">ticks_left</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="mi">0</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="n">this</span><span class="p">.</span><span class="n">running</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">false</span><span class="p">;</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>


<p>the error on use of <code>this</code> both suggests to change it to <code>self</code> and add a <code>self</code> argument to the function, so the guidance there looks good</p>



<a name="209252451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/MCP%3A%20document%20%27variables%27%20as%20%27bindings%27%20instead%3F/near/209252451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/MCP.3A.20document.20&#x27;variables&#x27;.20as.20&#x27;bindings&#x27;.20instead.3F.html#209252451">(Sep 07 2020 at 02:39)</a>:</h4>
<p>I opened an issue for this: <a href="https://github.com/rust-lang/rust/issues/76421">https://github.com/rust-lang/rust/issues/76421</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>